package org.ushio.speech_module.speech.dialoguebook;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Asus
 */
@Mapper
public interface DialogueBookMapper {

    DialogueBook findById(Long bookId);

    List<DialogueBook> findAll();

    int insert(DialogueBook dialogueBook);

    int update(DialogueBook dialogueBook);

    int deleteById(@Param("bookId") Long bookId);

    @Select("SELECT COUNT(*) FROM chapter WHERE book_id = #{bookId}")
    int countChaptersByBookId(@Param("bookId") Long bookId);

}